package com.yeyks.appcontroller;

import com.yeyks.dal.domain.UserInfo;
import com.yeyks.model.Ajax.AjaxResponseBody;
import com.yeyks.service.CczcService;
import com.yeyks.service.UserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author fuchangshuai
 * @date 2019/3/26 4:27 PM
 */
@Api(tags = "曹超专车", description = "曹超专车")
@Slf4j
@RestController
@RequestMapping(value = "/app/cczc")
public class CczcInfoController {

    @Autowired
    private UserInfoService userInfoService;
    @Autowired
    private CczcService cczcService;
    /**
     * 获取曹超专车的sign
     *
     * @return
     */
    @ApiOperation(value = "获取曹超专车的sign", notes = "获取曹超专车的sign")
    @ApiImplicitParam(paramType = "query", name = "token", value = "token", required = true, dataType = "String")
    @RequestMapping(value = "/sign", method = RequestMethod.POST)
    public ResponseEntity<?> cczcSign(@RequestParam(value = "token") String token) {
        UserInfo accountInfo = userInfoService.tokenUserInfo(token);
        Integer userId = accountInfo.getId();
        Map<String, String> map = cczcService.getSign(userId);
        return ResponseEntity.ok(AjaxResponseBody.success(map));
    }
}
